package com.hsd.znsh.repository;

import com.hsd.znsh.entity.Product;
import com.hsd.znsh.entity.ProductType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-23 11:54:50
 */
public interface ProductTypeRepository extends JpaRepository<ProductType,Integer> {

    List<ProductType> findByDeleted(Integer deleted);

    @Query("select distinct parentId from ProductType where parentId is not null")
    List<Integer> findParentIdList();

    List<ProductType> findByNameLikeAndIdNotIn(String productName,List<Integer> parentIds);

}
